// I haven't debug it yet.........................

function showAllCookies(showerObj) {
    showerObj.value = document.cookie;
}
function showCookie( showerObj, key) {
    showerObj.value = readCookie(key);    
}
function clearCookies(){
    var cookieAry = document.cookie.split(';');
    for ( var cookieCnt = 0; cookieCnt < cookieAry.length; cookieCnt++ ) {
        var cookieKey = cookieAry[cookieCnt].split('=')[0];
        deleteCookie( cookieKey );
    }
}
function deleteCookie( key ) {
    writeCookie( key, '', -1 );
}
function readCookie( key ) {
    var cookieAry = document.cookie.split(';');
    for ( var cookieCnt = 0; cookieCnt < cookieAry.length; cookieCnt++ ) {
        var cookieStr = cookieAry[cookieCnt];
        while ( cookieStr.charAt(0) == ' ' ) {
            cookieStr = cookieStr.substr(1, cookieStr.length);
        }
        if ( cookieStr.indexOf( key + '=', 0) == 0 ) {
            return cookieStr.substring( (key + '=').length, cookieStr.length );
        }
    }
    return null;
}
function writeCookie( key, value, days ) {
    if ( isNaN(days) ) {
        days = 1;
    }
    var expireDate = new Date();
    expireDate.setTime( expireDate.getTime() + ( days * 24 * 60 * 60 * 1000 ));
    var expireDateStr = "; expires=" + expireDate.toGMTString();
    var strToCookie = key + "=" + value + expireDateStr + "; path=/";
    document.cookie = strToCookie;
}
